<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Complex Layout - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/js/easyui/demo/demo.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/search/corpinfo.jsp"></script>
<script>
	$('#funcheck').ready(function() {
		alert($('#CSRFToken').val());
		var headers = {};
		headers['__RequestVerificationToken'] = $('#CSRFToken').val();
		$.ajax({
			type : "POST",
			headers : headers,
			cache : false,
			url : "${pageContext.request.contextPath}/function/info.do",
			data : {
				name : '${username}'
			},
			dataType : "json",
			async : true,
			error : function(data, error) {
			},
			success : function(data) {
				var fud = document.getElementById("funcheck");

				for (i in data) {
					var jd = data[i].name;
					var adiv = document.createElement("div");
					var ahref = document.createElement("p");
					adiv.className = "autdiv";
					fud.appendChild(adiv);
					ahref.innerHTML = jd;
					ahref.id = data[i].url;
					adiv.appendChild(ahref);
				}

			}

		})
	});
	$(function() {
		$("#funcheck").click(function(e) {
			var a = $(e.target).attr("id");
			 if (a != "funcheck" && a != "usermsg" && a != "infoserach"
			 && a.indexOf("autdiv") < 0) {
			 var headers = {};
			 headers['__RequestVerificationToken'] = $("#CSRFToken").val();
			 $.ajax({
			 type: "POST",
			 contentType: "application/x-www-form-urlencoded; charset=utf-8",
			 headers: headers,
			 cache: false,
			 url: "${pageContext.request.contextPath}/select/"+ a + ".do",
			 dataType:"html",
			 async: true,
			 error: function(data, error) {alert("SSSSSSSSSS")},
			 success: function(data)
			 { 
				 alert(data);
				 $('#pageDisp').html(data);
				 //重新渲染easyui
				 $.parser.parse($('#tablecorp').parent())
				 
			 }
			  })
			 					} else {
			 $('#jsp1').attr("src", "#");
			 } 
		})
	});
</script>
</head>
<body>
	<h2>彩铃平台信息查询</h2>
	当前用户：${username}
	<div>
		<form action="${pageContext.request.contextPath}/loginout/loginout.do">
			<input type="submit" value="退出登录">
		</form>
		<input type="hidden" id="CSRFToken" value="${csrf}" />
	</div>
	<div style="margin: 20px 0;"></div>
	<div class="easyui-layout" style="width: 100%; height: 720px;">

		<div data-options="region:'west',split:true" title="菜单"
			style="width: 100px;">
			<div class="easyui-accordion" data-options="fit:true,border:false">
				<div title="信息查询" id="funcheck" data-options="selected:true"
					style="padding: 10px;"></div>
			</div>
		</div>
		<div data-options="region:'center',title:'数据',iconCls:'icon-ok'">
			<div class="easyui-tabs"
				data-options="fit:true,border:false,plain:true">
				<div title=" " id="pageDisp">
				</div>
			</div>
		</div>
	</div>
</body>
</html>